<?php
$access_level = 3;
$page_title = 'eTAT';
require_once 'controller.php';

if(!isset($params->e)) {
//	$_SESSION['m'] = '5';
//	redirect('index.php');
	$params->e = base64_encode('sanketsp@gmail.com');
	$params->i = base64_encode('2');
	$params->g = base64_encode('1');
}

require_once 'Header.php';
print "<h1>Student Information</h1><br>";

if(isset($_POST['student_info_submit'])) {
	$query = mysql_query("UPDATE `student` WHERE `id` = '{$_POST['$student_id']}");
	
} else {
	$gmail = base64_decode($params->e);
	$id = base64_decode($params->i);
	$instructor = new Instructor($id);
	$group = base64_decode($params->g);
?>
<p>Hi <?php print $email; ?>,</p>
<p>You have been requested by <?php print "$instructor->full_name ($instructor->email)"; ?> to fill out this form.</p>
<p>The data that you will fill out below is intended for this Teamwork Assessment Tool (eTAT) only, and will not be shared with anyone.</p>
<p>If you have any concerns, please email your instructor <a href='mailto:<?php print $instructor->email; ?>'>here</a>.</p>
<br>
<?php 
	$form = new Form('student_info','post');
	$form->text('<p>Name and Email:</p>');
	$form->textInput('full_name','Full Name');
	$form->textInput('gmail','Gmail Address',array('value'=>$gmail,'readonly'=>true));
	$form->textInput('group_id','',array('class'=>'invisible','value'=>$group));
	$form->textInput('instructor_id','',array('class'=>'invisible','value'=>$instructor->id));
	$form->button('student_info_submit','Submit');
	print $form->build();
}
?>

<div class='clear'></div>
<?php require_once 'footer.php'; ?>